package lava.rt.linq.sql;



public abstract class SqlExecuteTask implements Runnable{

	
	  protected final String sql;
	  
	  protected final Object[][] params;
	 
	  
	  public SqlExecuteTask(String sql, Object[] param) {
		super();
		this.sql = sql;
		this.params = new Object[][]{param};
	  }
	  
	  public SqlExecuteTask(String sql, Object[][] params) {
			super();
			this.sql = sql;
			this.params = params;
	 }



	@Override
	public final void run() {
		try {
			int re=execute();
			onRunSuccess(re);
		} catch (SqlDataContextExecption e) {
			onRunExecption(e);
		}
		
	}



	



	public abstract int execute() throws SqlDataContextExecption;
	
	public void onRunSuccess(int re) {}
	
	private void onRunExecption(SqlDataContextExecption e) {}
	
}
